﻿@using QqhrCitizen.Models.ViewModel
@{
    ViewBag.Title = "产品展示";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
    vProduct product = ViewBag.Product as vProduct;
}

<h1 class="head-tietle">@product.Title - 产品展示 <a href="/Admin/ProductEdit/@product.ID">修改</a></h1>
<table class="detail-table">
    <tr>
        <td class="row-title">标题</td>
        <td>
            @product.Title
        </td>
    </tr>
    <tr>
        <td class="row-title">
            描述
        </td>
        <td>
            @product.Description
        </td>
    </tr>
    <tr>
        <td class="row-title">
            分类
        </td>
        <td>
            @product.Belong  / @product.ProductCategory
        </td>
    </tr>
    @if (product.Belong == ProductBelong.产品.ToString())
    {
        <tr>
            <td class="row-title">
                价格
            </td>
            <td>
                @product.Price
            </td>
        </tr>
    }
    @if (product.Belong == ProductBelong.作品.ToString())
    {
        <tr>
            <td class="row-title">
                对应用户名
            </td>
            <td>
                @product.TUsername
            </td>
        </tr>
    }
    <tr>
        <td class="row-title">
            时间
        </td>
        <td>
            @product.Time
        </td>
    </tr>
    <tr>
        <td class="row-title">
            操作员
        </td>
        <td>
            @product.Username
        </td>
    </tr>
</table>

<h3>图片 <a href="/Admin/AddProductImage/@product.ID">增加图片</a></h3>
<table class="detail-table">
    @foreach (var item in product.ProductImages)
    {
        <tr id="@item.ID">
            <td>@item.ID</td>
            <td>
                <img src="@item.Path" alt="@product.Title" width="80" height="60" />
            </td>
            <td>
                <a href="javascript:deleteDialog('/Admin/ProductImageDelete/' + @item.ID + '?sid=@ViewBag.SID',@item.ID);">删除</a>
            </td>
        </tr>
    }
</table>

<h3>视频 <a href="/Admin/AddProductVideo/@product.ID">增加</a></h3>
<table class="detail-table">
    @if (product.ProductVideo != null)
    {
        <tr>
            <td>@product.ProductVideo.ID</td>
            <td>
                <a href="javascript:deleteDialog('/Admin/ProductVideoDelete/' + @product.ProductVideo.ID + '?sid=@ViewBag.SID',@product.ProductVideo.ID);">删除</a>
            </td>
        </tr>
    }
</table>

